package com.jeasonzhao.report.engine.servlet;

import com.jeasonzhao.web.BodyCarelessTag;
import com.jeasonzhao.report.engine.Version;
/**
 * Record all context information with JavaScript
 */
public class TagReportContext extends BodyCarelessTag
{
    private static final long serialVersionUID = 1L;
    public TagReportContext()
    {
        super();
    }

    protected void body()
        throws Exception
    {
        StringBuffer buffer=new StringBuffer();
        buffer.append("window.SQLReport={};");
        if(null!= Version.getInstance())
        {
            buffer.append("window.SQLReport.version=\""
                          + Version.getInstance().getVersion()
                          + "\";");
            buffer.append("window.SQLReport.vendor=\""
                          + Version.getInstance().getVendor()
                          + "\";");
            buffer.append("window.SQLReport.codeName=\""
                          + Version.getInstance().getCodeName()
                          + "\";");
        }
//        JSBuilder builder=new JSBuilder(JSBeautify.beautify(buffer.toString()));
//        this.writeln(builder.getStringWithDeclaration());
    }
}
